﻿using Ln.Tool.Domain.Shared;
using Ln.Tool.Domain.Shared.Options;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Ln.Tool.Domain;

[DependsOn(typeof(LnToolDomainSharedModule))]
public class LnToolDomainModule : AbpModule
{
	public override void ConfigureServices(ServiceConfigurationContext context)
	{
		var configuration = context.Services.GetConfiguration();
		Configure<ToolOptions>(configuration.GetSection("ToolOptions"));
		var toolOptions = new ToolOptions();
		configuration.GetSection("ToolOptions").Bind(toolOptions);
		if (!Directory.Exists(toolOptions.TempDirPath))
		{
			Directory.CreateDirectory(toolOptions.TempDirPath);
		}
	}
}